// @algorithm @lc id=100275 lang=cpp 
// @title shu-zu-zhong-zhong-fu-de-shu-zi-lcof


#include <iostream>
#include <vector>
#include <string>
#include "algm/algm.h"
using namespace std;
class Solution {
public:
    int findRepeatNumber(vector<int>& nums) {
        int n = nums.size();
        vector<int> ret;
        //遍历数组，让每个出现过的数所在的位置加n
        for(int i = 0;i < n;i++){
            int x = (nums[i] - 1) % n;
            nums[x] += n;
        }
        for(int i = 0;i < n;i++){
            int x = nums[i];
            if(nums[i] > 2 * n) {
                ret.push_back(i + 1);
            }
        }
        return ret[0];
    }
};